import java.io.DataOutputStream;

public class Common {
//    public static
public static class RequestC{
        private String command;
        private String url_head;
        private String body;
        public ResponseC responseC = new ResponseC();
        public String getCommand() {
            return command;
        }

        public void setCommand(String command) {
            this.command = command;
        }

        public String getUrl_head() {
            return url_head;
        }

        public void setUrl_head(String url_head) {
            this.url_head = url_head;
        }

        public String getBody() {
            return body;
        }

        public void setBody(String body) {
            this.body = body;
        }

        @Override
        public String toString() {
            return "RequestC{" +
                    "command='" + command + '\'' +
                    ", url_head='" + url_head + '\'' +
                    ", body='" + body + '\'' +
                    '}';
        }
        public String toTransString(){
            return command+"\n"+url_head+"\n\n"+body;
        }

    }
    public RequestC parseReq(String p){
        RequestC requestC = new RequestC();
        String[] split1 = p.split("\n\n");
        requestC.setBody(split1[1]);
        String s = split1[0];
        String[] s2 = s.split("\n");
        requestC.setCommand(s2[0]);
        requestC.setUrl_head(s2[1]);
        return requestC;
    }
    public ResponseC parseRes(String p){
        ResponseC responseC = new ResponseC();
        String[] split = p.split("\n\n");
        responseC.setStatus(split[0]);
        responseC.setBody(split[1]);
        return responseC;
    }
    public static class ResponseC{
        private String status;
        private String body;
        public DataOutputStream dataOutputStream;

        @Override
        public String toString() {
            return "ResponseC{" +
                    "status='" + status + '\'' +
                    ", body='" + body + '\'' +
                    '}';
        }


        public String toTransString(){
            return status+"\n\n"+body;
        }

        public String getStatus() {
            return status;
        }

        public void setStatus(String status) {
            this.status = status;
        }

        public String getBody() {
            return body;
        }

        public void setBody(String body) {
            this.body = body;
        }
    }
    public static void debug(Object o){
        String s = "Thread : "+Thread.currentThread().getName();

        System.out.println(s+" o: "+o.toString());
    }
}
